<template>
  <z-modal
      v-bind="modalOption"
      @ok="handleOk"
      @cancel="handleCancel"
      cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form-model layout="horizontal" :label-col="labelCol" :wrapper-col="wrapperCol" ref="ruleForm" :model="form" :rules="validatorRules">
        <a-row>
          <a-col :span="12" >
            <a-form-model-item label="姓名" prop = "wxName" >
              <a-input v-model.trim="form.wxName" aria-required="true" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="电话" prop = "wxPhone" >
              <a-input v-model.trim="form.wxPhone" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="单位名称" prop = "wxCompany" >
              <a-input v-model.trim="form.wxCompany" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="业务类型" prop = "bizType" >
              <z-dict-select-tag  v-model="form.bizType" placeholder="请选择业务类型" dictCode="bizType" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='10'">
            <a-form-model-item label="颜色" prop = "printColor">
              <z-dict-select-tag  v-model="form.printColor" placeholder="请选择颜色" dictCode="printColor" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='30'">
            <a-form-model-item label="颜色" prop = "bannerColor">
              <z-dict-select-tag  v-model="form.bannerColor" placeholder="请选择颜色" dictCode="bannerColor" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='10'">
            <a-form-model-item label="尺寸" prop = "size">
              <z-dict-select-tag  v-model="form.size" placeholder="请选择尺寸" dictCode="size" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='10'">
            <a-form-model-item label="打印类型" prop = "printType">
              <z-dict-select-tag  v-model="form.printType" placeholder="请选择打印类型" dictCode="printType" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='10'">
            <a-form-model-item label="纸张类型" prop = "printPaperType">
              <z-dict-select-tag  v-model="form.printPaperType" placeholder="请选择纸张类型" dictCode="printPaperType" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='20'">
            <a-form-model-item label="纸张类型" prop = "cardPaperType">
              <z-dict-select-tag  v-model="form.cardPaperType" placeholder="请选择纸张类型" dictCode="cardPaperType" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='10'||form.bizType==='20'">
            <a-form-model-item label="数量" prop = "num">
              <a-input v-model.trim="form.num" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='10'">
            <a-form-model-item label="装订方式" prop = "bindType">
              <z-dict-select-tag  v-model="form.bindType" placeholder="请选择装订方式" dictCode="bindType" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='10'">
            <a-form-model-item label="装订本数" prop = "bindNum">
              <a-input v-model.trim="form.bindNum" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='30'">
            <a-form-model-item label="长度" prop = "length">
              <a-input v-model.trim="form.length" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='30'">
            <a-form-model-item label="内容" prop = "content">
              <a-input v-model.trim="form.content" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" v-if="form.bizType==='50'">
            <a-form-model-item label="设计类型" prop = "designType">
              <z-dict-select-tag  v-model="form.designType" placeholder="请选择设计类型" dictCode="designType" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="期望交付日期" prop = "expectDate" >
              <a-date-picker v-model.trim="form.expectDate" :disabled="getDisabled" style="width: 100%;"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="开票状态" prop = "billStat" >
              <z-dict-select-tag  v-model="form.billStat" placeholder="请选择开票状态" dictCode="billStat" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="实付金额" prop = "paidAmt" >
              <a-input-number v-model.trim="form.paidAmt" :min="0" :step="0.1" style="width: 100%;" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="付款状态" prop = "paidStat" >
              <z-dict-select-tag  v-model="form.paidStat" placeholder="请选择付款状态" dictCode="paidStat" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="其他需求" prop = "otherDemand" >
              <a-input v-model.trim="form.otherDemand" type="textarea" :disabled="getDisabled"/>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </z-modal>
</template>

<script>
import ModalFormMixin from '@/mixins/ModalFormMixin'
import ZDictSelectTag from '@/components/dict/ZDictSelectTag'
import { postAction, getAction } from '@/services/manage'
export default {
  name: 'OrderDetail',
  mixins: [ModalFormMixin],
  components: {
    ZDictSelectTag
  },
  data() {
    return {
      formDisabled: false,
      url: {
        edit: '/doc/order/v1/edit',
        add: '/doc/order/v1/add'
      },
      validatorRules: {
        wxName: [
          { required: true, message: '请输入姓名', trigger: 'blur' }
        ],
        wxPhone: [
          { required: true, message: '请输入电话', trigger: 'blur' }
        ],
        wxCompany: [
          { required: true, message: '请输入单位名称', trigger: 'blur' }
        ],
        bizType: [
          { required: true, message: '请选择业务类型', trigger: 'blur' }
        ]
      }
    }
  },
  computed: {
    getDisabled() {
      if (this.editType === 'add') {
        // 新增允许编辑
        return false
      }
      return true
    }
  },
  methods: {
  }
}
</script>
